//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.yaukie.xtl.exceptions;

import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;

public class XtlExceptions extends RuntimeException implements Serializable {
    public XtlExceptions() {
    }

    public XtlExceptions(String message) {
        super(message);
    }

    public XtlExceptions(String message, Throwable throwable) {
        super(message, throwable);
    }

    public XtlExceptions(Throwable throwable) {
        super(throwable);
    }

    public RuntimeException runtimeException(Exception e) {
        return e instanceof RuntimeException ? (RuntimeException)e : new RuntimeException(e);
    }

    public String getStackTraceAsString(Exception e) {
        StringWriter out = new StringWriter();
        e.printStackTrace(new PrintWriter(out));
        return out.toString();
    }

    public boolean isCausedBy(Exception e, Class<? extends Exception>... causeExceptionClasses) {
        Throwable throwable = e.getCause();
        if (throwable != null) {
            Class[] var4 = causeExceptionClasses;
            int var5 = causeExceptionClasses.length;

            for(int var6 = 0; var6 < var5; ++var6) {
                Class<? extends Exception> causeExceptionClass = var4[var6];
                if (causeExceptionClass.isInstance(throwable)) {
                    return true;
                }
            }

            throwable = throwable.getCause();
        }

        return false;
    }
}
